import React,{Component} from 'react'
import classNames from 'classnames/bind';
import styles from './editorheader.scss'
import {Avatar,Icon,Button} from 'antd'
import { withRouter } from 'react-router-dom'
import img from '../../util/avatars/default.png'

let cx = classNames.bind(styles);


class Header extends Component{
  render()
  {
    const go=this.props.history.push;
    return ( 
      <div className={cx('header')}>
        <div className={cx('logo')}>
          <span>微人事文档编辑中心</span>
          <a href='/'>前往首页</a>
        </div>
        <ul className>
        <li>
            <Button className={cx('icon')} onClick={()=>{go('/admin/werenshi/postedit')}}>
              <Icon type="edit"/>
              新建文档
            </Button>

        </li>

        <li>
          <Button className={cx('icon')} onClick={()=>{sessionStorage.removeItem('username');go('/login')}}>
              <Icon type="logout" />
              退出
          </Button>
        </li>

        <li>
          <Avatar src={img} />
        </li>
        </ul>
      </div>)
  }
}
export default withRouter(Header);